package blueBridge;

import java.util.Scanner;

/*

3 2

16



                          选(0, 0)                              不选(0, 0)
                       /            \                          /         \
               选(0, 1)              不选(0, 1)         选(0, 1)           不选(0, 1)
               /     \               /      \           /     \             /      \
         选(0, 2)   不选(0, 2)  选(0, 2)  不选(0, 2)  选(0, 2)   不选(0, 2)  选(0, 2)  不选(0, 2)
          ...

 */

public class Main887 {
    int n;
    int k;
    
    

    private Main887(int n, int k) {
        super();
        this.n = n;
        this.k = k;
    }

    
    private int getCount() {
        int[] board = new int[n];
        int count = dfs(0, 0, 0, board);
        return count;
    }


    private int dfs(int row, int col, int settled, int[] board) {
        /*
        for (int i = 0; i < n; i++) {
            System.out.println(Integer.toBinaryString(board[i]));
        }
        System.out.println();
        */
        if (settled == k) {
            /*
            for (int i = 0; i < n; i++) {
                System.out.println(Integer.toBinaryString(board[i]));
            }
            System.out.println();
            */
            return 1;
        }
        if (row >= n) {
            return 0;
        }
        int count = 0;
        int temp1 = board[row];
        int temp2 = settled;
        // 先放置再判断
        board[row] ^= (1 << (n - col - 1));
        settled++;
        // 判断如果这样放置是可行的，在这个基础上继续深搜
        if (isOK(row, board)) {
            if (col == n - 1) {
                count += dfs(row + 1, 0, settled, board);
            } else {
                count += dfs(row, col + 1, settled, board);
            }
        }
        // 另一个分支，该位置不放置的基础上，继续深搜
        board[row] = temp1;
        settled = temp2;
        if (col == n - 1) {
            count += dfs(row + 1, 0, settled, board);
        } else {
            count += dfs(row, col + 1, settled, board);
        }
        System.out.println(count + " => " + row + ", " + Integer.toBinaryString(board[row]) + ", " + settled);
        return count;
    }
    

    
    private boolean isOK(int row, int[] board) {
        if (row == 0) {
            // 只需判断本行之间有没有侵犯
            if ((board[row] & (board[row] >> 1)) > 0) {
                return false;
            } else {
                return true;
            }
        }
        // 下面是判断row > 0的情况
        // 判断本行之间有没有侵犯
        if ((board[row] & (board[row] >> 1)) > 0) {
            return false;
        }
        // 判断本行与上一行之间有没有侵犯
        if ((board[row] & board[row-1]) > 0) {
            return false;
        }
        if ((board[row] & (board[row-1] >> 1)) > 0) {
            return false;
        }
        if ((board[row] & (board[row-1] << 1)) > 0) {
            return false;
        }
        return true;
    }


    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        Main887 m = new Main887(n, k);
        System.out.println(m.getCount());

    }





    

}
